<template>
  <div class="skeleton-table">
    <div class="skeleton-header" v-if="showHeader">
      <div class="skeleton-header-item" v-for="i in columns" :key="'header-'+i"></div>
    </div>
    <div class="skeleton-row" v-for="row in rows" :key="'row-'+row">
      <div class="skeleton-cell" v-for="col in columns" :key="'cell-'+row+'-'+col"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SkeletonTable',
  props: {
    rows: {
      type: Number,
      default: 5
    },
    columns: {
      type: Number,
      default: 8
    },
    showHeader: {
      type: Boolean,
      default: true
    }
  }
}
</script>

<style scoped>
.skeleton-table {
  width: 100%;
}

.skeleton-header {
  display: flex;
  margin-bottom: 16px;
}

.skeleton-header-item {
  flex: 1;
  height: 24px;
  margin: 0 10px;
  background: #f2f2f2;
  border-radius: 4px;
}

.skeleton-row {
  display: flex;
  margin-bottom: 12px;
}

.skeleton-cell {
  flex: 1;
  height: 32px;
  margin: 0 10px;
  background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 50%, #f2f2f2 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
</style> 